import { Controller, Get, Post, Body, Param, Delete, Put, Query } from '@nestjs/common';
import { Platformsort_Service } from './platformsort.service';
import { Platformsort_Create_Dto, Platformsort_Update_Dto } from './assets/platformsort.dto';
import { Platformsort_Find_Dto } from './assets/platformsort.dto';
import { ApiExtraModels, ApiTags } from '@nestjs/swagger';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { util_Index_ReturnContent } from '@/common/util/index';
import { Class_Index_ListAll } from '@/common/classes/index';

@Controller('/adm/platformsort')
@ApiTags('platformsort 商品分类')
export class Platformsort_Controller {
  constructor(private readonly platformsort_Service: Platformsort_Service) {}

  @Post('/add')
  @util_ApiResponse_Base({
    dataType: 'dataType_add',
    //apiKey: '/adm/platformsort/add Post',
  })
  async platformsort_Create(@Body() body: Platformsort_Create_Dto) {
    return util_Index_ReturnContent(await this.platformsort_Service.platformsort_Create(body));
  }

  @Get('/list')
  @util_ApiResponse_Base({
    dataType: 'dataType_list',
    //apiKey: '/adm/platformsort/list Get',
  })
  async platformsort_FindByPage(@Query() query: Platformsort_Find_Dto) {
    return util_Index_ReturnContent(await this.platformsort_Service.platformsort_FindByPage(query));
  }

  @Put('/update')
  @util_ApiResponse_Base({
    dataType: 'dataType_update',
    //apiKey: '/adm/platformsort/update Put',
  })
  async platformsort_Update(@Body() body: Platformsort_Update_Dto) {
    return util_Index_ReturnContent(await this.platformsort_Service.platformsort_Update(body));
  }

  @Delete('/delete/:id')
  @util_ApiResponse_Base({
    dataType: 'dataType_delete',
  })
  async platformsort_Remove(@Param('id') id: string) {
    return util_Index_ReturnContent(await this.platformsort_Service.platformsort_Remove(+id));
  }

  @Get('/listSelect')
  @ApiExtraModels(Class_Index_ListAll)
  @util_ApiResponse_Base({
    dataType: 'dataType_list',
    type: Class_Index_ListAll,
  })
  async platformsort_Adm_FindAllSelect() {
    return util_Index_ReturnContent(await this.platformsort_Service.platformsort_Adm_FindAllSelect());
  }
}
